package dk.mirasola.systemtraining.bridgewidgets.client.ui.editor;

import com.google.gwt.editor.client.LeafValueEditor;
import dk.mirasola.systemtraining.bridgewidgets.shared.model.distributionfiltertree.CardsCountInterval;

public class CardsCountIntervalEditor extends IntervalEditor implements LeafValueEditor<CardsCountInterval> {
    @Override
    protected int getIntervalMax() {
        return CardsCountInterval.CARDS_COUNT_INTERVAL_MAX;
    }

    @Override
    protected int getIntervalMin() {
        return CardsCountInterval.CARDS_COUNT_INTERVAL_MIN;
    }

    @Override
    public void setValue(CardsCountInterval value) {
        setValidMin(value.getMinCardsCount());
        setValidMax(value.getMaxCardsCount());
    }

    @Override
    public CardsCountInterval getValue() {
        return CardsCountInterval.create(getValidMin(), getValidMax(), true);
    }
}
